package com.lanqiao.pet.test;

import com.lanqiao.pet.entity.Cat;
import com.lanqiao.pet.entity.Dog;
import com.lanqiao.pet.entity.Pet;
import com.lanqiao.pet.entity.Tool;

import java.security.AllPermission;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


public class Admin {

    public String name; //解释器

    public static String kind;

    public static void main(String[] args) {
        int[] nums = new int[5];
        int[] nums1 = {1, 2, 3, 4, 5};
        for (int i : nums1) {

        }
        List list = new ArrayList();


//        Scanner input = new Scanner(System.in);
//        //实例化对象
//        Dog dog = new Dog("金毛");
//        dog.setName("旺财");
//        dog.lookDoor();
//        System.out.println(dog.bark());
//        System.out.println(dog.getKind());
//        dog.setAge(111);
//        System.out.println(dog.getName() + " 年龄 " + dog.getAge() + " 品种 " + dog.getKind());
//
//        //对象的方法
//        String sound = dog.bark();
//        System.out.println(sound);
//        String food = "骨头";
//        dog.eat(food);
//        dog.eat("骨头");
//        dog.sleep();

//        System.out.println(Tool.str);
//        Tool.show();


//        Pet[] pets = new Pet[2];
//        Cat cat = new Cat("波斯");
//        pets[0] = cat;
//        Dog dog = new Dog("金毛");
//        pets[1] = dog;
//        feed(pets);

        feed(new Pet[]{new Cat("波斯"), new Dog("金毛")});

//        feed(new Cat("波斯"),new Dog("金毛"));
//        cat.setName("小猫");
//        System.out.println(cat.bark());
//        cat.eat("鱼");
//        cat.sleep();
//        System.out.println(cat);

    }

    int i = 100;

    public static void feed(Pet... pets) {
        for (int i = 0; i < pets.length; i++) {
            if (pets[i] instanceof Dog)
                pets[i].eat("骨头");
            else
                pets[i].eat("鱼");
        }
    }


}
